package com.chat.websocket.entity.dto;

/**
 * SunJingxuan
 * 2022 \ 08 \ 08
 */

public class SuperDTO {

	private Integer pageIndex;
	private Integer pageSize;

	private Integer page;
	private Integer size;

	public SuperDTO() {}

	public SuperDTO(Integer pageIndex, Integer pageSize) {
		this.pageIndex = pageIndex;
		this.pageSize = pageSize;
	}

	public Integer getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getPage() {
		if (this.pageIndex == null || this.pageIndex == 0) {
			return 0;
		} else {
			return (this.pageIndex - 1) * this.pageSize;
		}
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getSize() {
		if (this.pageSize == null) {
			return 20;
		}
		return this.pageSize;
	}

	public void setSize(Integer size) {
		this.size = size;
	}
}
